﻿// -----------------------------------------------------------------------
// <copyright company="Christoph van der Fecht - VDsoft">
// This code can be used in commercial, free and open source projects.
// </copyright>
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace VDsoft.SeriesNewsReader
{
	/// <summary>
	/// Interaction logic for AboutDialog.xaml
	/// </summary>
	public partial class AboutDialog : Window
	{
		public AboutDialog()
		{
			InitializeComponent();
			Assembly ass = Assembly.GetExecutingAssembly();

			AssemblyTitleAttribute title = (AssemblyTitleAttribute)ass.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0];
			AssemblyProductAttribute product = (AssemblyProductAttribute)ass.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
			AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)ass.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0];
			AssemblyCompanyAttribute company = (AssemblyCompanyAttribute)ass.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0];
			AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)ass.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0];


			this.textBlockApplicationName.Text = product.Product;
			this.textBlockVersion.Text = ass.GetName().Version.ToString();
			this.textBlockCopyRight.Text = copyright.Copyright;
			this.textBlockDescription.Text = description.Description;
		}

		private void OnOkClick(object sender, RoutedEventArgs e)
		{
			this.Close();
		}

		private void OnLinkNavigation(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
		{
			Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
			e.Handled = true;
		}
	}
}
